package jp.tkym.labs.store;

import java.util.HashMap;
import java.util.Map;

import jp.tkym.labs.store.api.BeanQueryFilterOperator;

import com.google.appengine.api.datastore.Query.FilterOperator;

/**
 * 
 * @author kazunari
 */
class GoogleBeanQueryUtil {
	private Map<BeanQueryFilterOperator, FilterOperator> filterMap;

	GoogleBeanQueryUtil() {
		filterMap = new HashMap<BeanQueryFilterOperator, FilterOperator>();
		filterMap.put(BeanQueryFilterOperator.EQUAL, FilterOperator.EQUAL);
		filterMap.put(BeanQueryFilterOperator.GREATER_THAN,
				FilterOperator.GREATER_THAN);
		filterMap.put(BeanQueryFilterOperator.GREATER_THAN_OR_EQUAL,
				FilterOperator.GREATER_THAN_OR_EQUAL);
		filterMap.put(BeanQueryFilterOperator.LESS_THAN,
				FilterOperator.LESS_THAN);
		filterMap.put(BeanQueryFilterOperator.LESS_THAN_OR_EQUAL,
				FilterOperator.LESS_THAN_OR_EQUAL);
		filterMap.put(BeanQueryFilterOperator.NOT_EQUAL,
				FilterOperator.NOT_EQUAL);
		filterMap.put(BeanQueryFilterOperator.IN, FilterOperator.IN);
	}

	FilterOperator filterOperator(BeanQueryFilterOperator operator) {
		return filterMap.get(operator);
	}
}